package com.carey.blog.repository;

import org.json.JSONObject;

import com.carey.blog.framework.latke.repository.Repository;
import com.carey.blog.framework.latke.repository.RepositoryException;

/**
 * Link repository.
 * 
 */
public interface LinkRepository extends Repository {

	/**
	 * Gets a link by the specified address.
	 * 
	 * @param address
	 *            the specified address
	 * @return link, returns {@code null} if not found
	 */
	JSONObject getByAddress(final String address);

	/**
	 * Gets the maximum order.
	 * 
	 * @return order number, returns {@code -1} if not found
	 * @throws RepositoryException
	 *             repository exception
	 */
	int getMaxOrder() throws RepositoryException;

	/**
	 * Gets a link by the specified order.
	 * 
	 * @param order
	 *            the specified order
	 * @return link, returns {@code null} if not found
	 */
	JSONObject getByOrder(final int order);
}
